package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ShopCartMapper {

    void insert(ShoppingCart cart);


    List<ShoppingCart> getShopCart(ShoppingCart cart);

    @Update("update shopping_cart set  number = #{number} where user_id = #{userId}")
    void update(ShoppingCart cart);

    @Select("select * from dish where id = #{dishId}")
    Dish getdish(Long dishId);

    @Select("select * from setmeal where id = #{setmealId}")
    Setmeal getSetmeal(Long setmealId);

    @Select("select * from shopping_cart where user_id = #{currentId}")
    List<ShoppingCart> getShopCartByuserId(Long currentId);

    @Delete("delete from shopping_cart where user_id = #{userId}")
    void deleteShoppingCart(Long userId);

    @Select("select * from shopping_cart where user_id = #{userId}")
    List<ShoppingCart> list(ShoppingCart shoppingCart);


    Integer getNumberByid(Long id);

    @Delete("delete from shopping_cart where dish_id = #{dishId}")
    void deleteDish(Long dishId);

}
